<!DOCTYPE html>
<html lang="zh-CN">
<#assign html_title="搬砖之家|平台登录">
    <head>
        <#include "/components/head.htm"   />
    </head>


<body>
<div id="fullPage">
    <!--Page One-->
    <#include "/components/header.section.htm"   />

    <section>
        <div class="container white-block">
            <h2 class="form-signin-heading">&nbsp;</h2>
            <div class="row">
                <div class="col-sm-3">
                </div>
                <div class="col-sm-8">
                    <#if isLogin==false >
                        <form class="form-horizontal" >
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">手机号码 </label>
                                <div class="col-sm-4">
                                    <input class="form-control"  placeholder="手机号码" name="phone">
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">输入密码 </label>
                                <div class="col-sm-4">
                                    <input type="password" class="form-control" placeholder="密码" name="password">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-4">
                                    <button id="login-btn" class="btn  btn-primary btn-block" type="button">登录</button>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-4 text-right">
                                    <a href="/view/user/register"> >> 立即注册</a>
                                </div>
                            </div>
                        </form>
                        <#else>
                            <div class="col-sm-offset-3 col-sm-4">
                                <button class="btn  btn-primary btn-block" type="button"> <a href="/api/user/logout">退出登录</a> </button>
                            </div>
                    </#if>

                </div> <!-- /container -->
            </div>
        </div>
    </section>
</div>

</body>
<script>
    $(document).ready(function () {
        $("#login-btn").click(function () {
            $.ajax({
                method:'post',
                url:'/api/user/login',
                data:$('form').serialize(),
                success:function (response) {
                    if(response.success){
                        window.location.href=response.data;
                    }else{
                        alert(response.message);
                    }
                }
            })
        })
    });
</script>
</html>